/* testfiles.c
 *	Simple program to test the file handling system calls
 */

#include "syscall.h"

int index1= -1;
int index2= -1;

void Print(char* str){
  int c = 0;
  while((str[c] != '\n')){
    c++; 
  }
  c++;
  Write(str,c,ConsoleOutput);
	
}

int main() {
  OpenFileId fd;
  int bytesread;
  int i,j,condition;
  int i2,condition1;
  char buf[20];
 
  Print("test create lock\n");
  i = CreateLock(1);
  Print("\ncreate lock with index\n ");
  PrintInt(i);

 
  Acquire(i);
  Print("User Program: Acquiring the lock\n");

  condition = CreateCondition(1); 
  Print("User Program: Create Condition with lock index \n");
  PrintInt(i);
  Print(" condition index \n");
  PrintInt(condition);

  Print("Create 2nd lock\n");
  i2 = CreateLock(2);

  Print("Create 2nd condition\n");
  condition1 = CreateCondition(2);




  Print("\nTest wait\n");
  Wait(i,condition);
  Print("GOT SIGNAL***************\n");
  Release(i);


  
  Exit(0);
}
